<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <button @click="add">显示/消失</button>
        <div v-if="bn">显示/消失</div>
    </div>
</body>
<script src="Vue.js"></script>
<script>
    //2. 点击按钮，  如果div是显示状态，就把div隐藏，否则把div显示出来。
    const {createApp , ref} = Vue
    createApp({
        setup(){
        let bn = ref(false)
        function add(){
            bn.value = !bn.value
        }
        return{
            add,
            bn
        }
        }
    }).mount('#app')
</script>
</html>